﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SimpleSalesTrackingAPIWrapper
{
    public class Tasks
    {
        // Get list of all Tasks for this company
        public static List<SimpleSalesTrackingAPI.Task> GetTasksByOwner(string username, string password)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return new List<SimpleSalesTrackingAPI.Task>(api.GetTasksByOwner(username, password));
        }

        // Get list of all Tasks for the currently authenticated user.
        public static List<SimpleSalesTrackingAPI.Task> GetTasksByUser(string username, string password)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return new List<SimpleSalesTrackingAPI.Task>(api.GetTasksByUser(username, password));
        }

        // Get a single Task, by TaskId
        public static SimpleSalesTrackingAPI.Task GetTaskById(string username, string password, int taskId)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.GetTaskById(username, password, taskId);
        }

        // Insert a new Task
        public static int InsertTask(string username, string password, SimpleSalesTrackingAPI.Task task)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.InsertTask(username, password, task);
        }

        // Insert a new Task
        public static int InsertTask(string username, string password, int saleId, string name, string description, DateTime dueDate, int taskStatusId, int percentComplete)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.InsertTask2(username, password, saleId, name, description, dueDate, taskStatusId, percentComplete);
        }

        // Update an existing Task
        public static int UpdateTask(string username, string password, SimpleSalesTrackingAPI.Task task)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.UpdateTask(username, password, task);
        }

        // Update an existing Task
        public static int UpdateTask(string username, string password, int taskId, int saleId, string name, string description, DateTime dueDate, int taskStatusId, int percentComplete)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.UpdateTask2(username, password, taskId, saleId, name, description, dueDate, taskStatusId, percentComplete);
        }

        // Delete an existing Task
        public static int DeleteTask(string username, string password, SimpleSalesTrackingAPI.Task task)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.DeleteTask(username, password, task);
        }

        // Delete an existing Task
        public static int DeleteTask(string username, string password, int taskId)
        {
            SimpleSalesTrackingAPI.API api = new SimpleSalesTrackingAPI.API();
            return api.DeleteTask2(username, password, taskId);
        }

    }
}
